<h1>Galeries</h1>
<?php
$i=1;
$req_cha = $bdd->query('SELECT * FROM galeries ORDER BY nom');
while ($donnees_cha = $req_cha->fetch())
{
	$req = $bdd->prepare('SELECT * FROM images WHERE galerie=:galerie LIMIT 1');
	$req->execute(array(
		'galerie' => $donnees_cha['id']
		));
	
	while ($donnees = $req->fetch())
	{
		//echo $donnees_cha['id'];
		?>
		<a href="index.php?page=galeries&cat=<?php echo $donnees_cha['id']; ?>">
		<img src="<?php echo $donnees['image']; ?>" width="80" height="80" class="img-gauche"></a>
		<?php
		$i++;
		if ($i == 10) { echo '<br/>'; $i=1; }
	}
	?>
	</table>
	<?php
}
$req->closeCursor();
?>
